package com.psg.controller;

import com.psg.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

@Controller
public class BaseController {

    @Autowired
    private HttpServletRequest request;

    public User getUser(){
        HttpSession session = request.getSession();
        User user = (User) session.getAttribute("login");
        return user;
    }

    public Integer getUserId(){
        User user = getUser();
        return user.getuId();
    }
}
